/**
 * 历史记录，岗位需求信息
 */

import React from 'react';
import { Divider } from 'antd';
import { Descriptions } from '../../components';

const sexType = ['--', '男', '女', '无要求'];

const DemandDetail = ({ data = {}, salaryCurrencyCode = '' }) => {
    const {
        recruitNums = '0',
        workNatureName = '--',
        recruitDegreeName = '--',
        workYearsName = '--',
        dutyName = '--',
        workCity = '--',
        minSalary = '',
        maxSalary = '',
        salaryNum = '',
        positionDuty = '',
        jobRequirement = '',
        recruitSex = 0
    } = data;

    const descriptions1 = [
        { label: '岗位名称', value: dutyName, required: true },
        { label: '招聘人数', value: recruitNums, required: true },
        { label: '工作城市', value: workCity, required: true },
        { label: '工作性质', value: workNatureName }
    ];

    const descriptions2 = [
        { label: '经验和学历', value: `${workYearsName}/${recruitDegreeName}`, required: true },
        { label: '性别', value: `${sexType[recruitSex]}` },
        {
            label: '薪资范围',
            value: `${minSalary ? `${minSalary}k` : ''}${maxSalary ? `-${maxSalary}k` : ''} ${salaryNum}${
                salaryNum ? `薪 ${salaryCurrencyCode}` : ''
            }`
        },
        {
            label: '职位要求',
            value: positionDuty,
            required: true
        },
        {
            label: '岗位要求',
            value: jobRequirement,
            required: true
        }
    ];

    return (
        <>
            <Descriptions title="基本信息" descriptions={descriptions1} />
            <Divider />
            <Descriptions title="岗位要求" descriptions={descriptions2} />
        </>
    );
};

export default DemandDetail;
